#ifndef __SENSE_MANAGER_H
#define __SENSE_MANAGER_H

#include "sys.h"

typedef enum{
	STYPE_VIBRATOR = 0,
	STYPE_INFRAREDTEMP,
}SenseType;


typedef struct SenseMemStruct{
	unsigned char *Addr;
	unsigned char ID;
	SenseType eType;
	unsigned char bOnline;
	unsigned char ucNoOnlineCount;
	unsigned char *pucSenseValue;
	unsigned char *pucTime;
	struct SenseMemStruct *ptNext;
}T_SenseMem, *PT_SenseMem;



typedef enum{
	SSMF_REPORTTIME = 0,
	SSMF_ONEID,
	SSMF_CONTINUEID,
	SSMF_ALLID,
}E_SaveSenseMemFunction;

typedef struct SenseOpr{
	char *name;
	int (*SenseMemInit)(void);
	int (*GetData)(void);
	int (*ReportData)(void);
	int (*SaveSenseMem)(E_SaveSenseMemFunction eFunction, void *MemData);
	int (*RegisterReport)(void);
	int (*MemMalloc)(uint8_t *pBuffer,uint8_t len);
	struct SenseOpr *ptNext;
}T_SenseOpr,*PT_SenseOpr;

int RegisterSenseOpr(PT_SenseOpr ptSenseOpr);
PT_SenseOpr GetSenseOpr(char *pcName);
void ShowSenseOpr(void);
int SenseInit(void);


int InfraredTempInit(void);
int VibratorInit(void);
int MachineInit(void);

void All_SenseMemInit(void);
void AllRegisterReport(uint32_t uibit);



int MachineAddrChange(uint16_t usAddr);
void ChangeReportTime(uint8_t *pDatabuffer, uint8_t *pTimeBuffer);
int SwitchOutputExecute(uint8_t *pDatabuffer, uint8_t *pTimeBuffer);

int GetFlagChange(uint8_t ucGetFlag);
void AllDeviceStatus(void);


void vSense_Task( void *pvParameters );

#endif
